﻿using System;
using System.Data;
using MyWeb.Business;
using MyWeb.Common;
using MyWeb.Data;

namespace MyWeb.Modules.Products
{
    public partial class Orders : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["TotalPrice"] != null)
            //{
            //    var objOrder = new Data.Orders();
            //    objOrder.CustormerId = Session["CusId"].ToString();
            //    objOrder.TotalMoney = Session["TotalPrice"].ToString();
            //    objOrder.CreatDate = DateTimeClass.ConvertDateTime(DateTime.Now.ToShortDateString(), "MM/dd/yyyy HH:mm:ss");
            //    //objOrder.DeliveryDate = DateTimeClass.ConvertDateTime(txtngaygiao.Text, "MM/dd/yyyy HH:mm:ss");
            //    objOrder.Status = "0";
            //    objOrder.Tag = "0";
            //    objOrder.Lang = "";
            //    OrdersService.Orders_Insert(objOrder);
            //}
            //var sql = new SqlDataProvider();
            //var orderIds = sql.MaxId("Orders", "Id");
            //var dt = (DataTable)Session["Card"];
            //if (dt.Rows.Count > 0)
            //{
            //    for (int i = 0; i < dt.Rows.Count; i++)
            //    {
            //        //var list = ProductsService.Products_GetById(dt.Rows[i]["Id"].ToString());
            //        var goisp = PackProductsService.PackProducts_GetByTop("", "ProductsId = '" + dt.Rows[i]["Id"] + "'", "");
            //        var objDetail = new OrderDetail();
            //        objDetail.OrderId = orderIds;
            //        objDetail.ProductsId = dt.Rows[i]["Id"].ToString();
            //        objDetail.Price = goisp[0].Price;
            //        objDetail.Quantity = dt.Rows[i]["Quantity"].ToString();
            //        objDetail.TotalMoney = dt.Rows[i]["Money"].ToString();
            //        objDetail.Lang = "";
            //        OrderDetailService.OrderDetail_Insert(objDetail);
            //    }
            //}
        }
    }
}